/******************************************************************************
* file  : console.c
* creat : apleilx
* data  : 2021/01/20
*******************************************************************************/
#include "os_obj.h"
#include "sys_task.h"
#include "pincfg.h"
#include "com_obj.h"
#include "dataproc.h"
#include "common.h"
#include "simp_txt_analysis.h"
#include "iohandle.h"
#include "str_ext.h"

extern const txt_cmd_cfg_type cmd_list[];

static uint8_t console_buff[101];
void cmd_analysis(uint8_t *cmd);
void sys_ui_tst(void);

/*****************************************************************************
* @brief   console task.
* @param   argument
* @return  none
*****************************************************************************/
void task_console(void *argument)
{
    uint16_t len;

    while (1)
    {
        osDelay(ms_ticks(20));

        len = com.obj01.fun->rcv_line(console_buff, 100);

        if (len > 0)
        {
            cmd_analysis(console_buff);
        }
    }
}

/*****************************************************************************
* @brief   cmd analysis.
* @param   cmd: cmd string
* @return  none
*****************************************************************************/
void cmd_analysis(uint8_t *cmd)
{
    
    if (0 == txt_cmd_analysis(cmd_list, (void *)cmd, 100))
    {
		dbg_print("cmd is not used: %s", cmd);
    }
}


